package utils;

import java.util.ArrayList;

import org.w3c.dom.Node;

import ki.NimDecisionTree;

public class TestNimAlphaBetaCut {

	public TestNimAlphaBetaCut() {
	}
	/**
	 * @param args
	 *
	 */
	private ArrayList<Node> makeChildsList(Node actualNode){
		ArrayList<Node> children = new ArrayList<Node>();
		
		for (int i = 0; i < actualNode.getChildNodes().getLength(); i++) {
			children.add(actualNode.getChildNodes().item(i));
		}
		
		return children;
	}
	
	private void testRootNode(TestNimAlphaBetaCut test, Node rootNode){
		ArrayList<Node> childTest = test.makeChildsList(rootNode);
		
		for (Node n : childTest) {
			System.out.println("value of childNode: "+ n.getNodeValue());
		}
	}
	
	private void testABcut(NimDecisionTree tree, Node rootNode){
		NimAlphaBetaCut abCut = new NimAlphaBetaCut(tree);
		Node nextNode = abCut.getBestTurn(rootNode);
				
		System.out.println("Value of nextNode: " + Integer.parseInt(nextNode.getNodeValue()));
	}
	
	static int maxRemove = 3;
	public static void main(String[] args) {
		
		TestNimAlphaBetaCut test = new TestNimAlphaBetaCut();
		NimDecisionTree tree = new NimDecisionTree(maxRemove);
		Node rootNode = tree.buildDecisionTree(8);

		
//		test.testRootNode(test, rootNode);
		test.testABcut(tree, rootNode);
		

	}

}
